@cachly-dev/mcp-server 0.10.265 → 0.10.267
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/src/ambient-hook.js +3 -3
- package/dist/src/herkunft.js +1 -1
- package/dist/src/index.js +176 -175
- package/dist/src/lern-rueckfrage.js +1 -0
- package/dist/src/remote-oauth.js +2 -0
- package/dist/src/remote-zugang.js +2 -2
- package/glama.json +1 -1
- package/hooks/cachly-ambient-einblendung.mjs +30 -29
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<p align="center"><a href="https://cachly.dev"><img src="https://cachly.dev/brand/cachly-dev.png" alt="cachly.dev" width="380"></a></p>
|
|
2
|
+
|
|
1
3
|
# cachly — memory for coding agents (MCP server)
|
|
2
4
|
|
|
3
5
|
> **Solve it once. From then on, your AI knows.**
|
|
@@ -12,6 +14,7 @@
|
|
|
12
14
|
[](./LICENSE)
|
|
13
15
|
[](https://registry.modelcontextprotocol.io/v0/servers?search=cachly)
|
|
14
16
|
[](https://cachly.dev/docs/eu-hosted-mcp-memory-server)
|
|
17
|
+
[](https://mcptry.com/servers/io.github.cachly-dev/mcp-server)
|
|
15
18
|
|
|
16
19
|
**Works with** Claude Code · Cursor · GitHub Copilot · Windsurf · Cline · Continue.dev · Zed ·
|
|
17
20
|
Codex CLI · Gemini CLI · JetBrains IDEs
|
package/dist/src/ambient-hook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readFileSync as
|
|
1
|
+
import{readFileSync as B}from"node:fs";import{tmpdir as O}from"node:os";import{parseHookPayload as L,runEinblendung as Y,stopLernanfrage as $,stopObservation as D}from"./ambient-cli.js";import{stopAntwort as J}from"./schreibbeleg.js";import{lernRueckfrage as V,lernaufrufImProtokollEnde as Q,frageIstFrisch as W,meldeAutoLernen as X}from"./lern-rueckfrage.js";import{holeBestand as q,hookAusgabe as Z,starteNebenlauf as P}from"./einblendung.js";import{STARTWISSEN_IMPORT as m,hookImportFuerAuftrag as ee,importiereStartwissen as te}from"./startwissen-hook.js";import{belohnungMelden as ne}from"./lernen.js";import{appendLedgerEntry as re,reportLedgerEntry as oe}from"./ambient-ledger.js";import{copilotHatHook as ie,cursorHatHook as se,findeInstanz as w,findeSchluessel as _,hookUmfeld as k,pluginVersion as F,projektHatHook as ce}from"./hook-zugang.js";import{ABKUEHLUNG_HOOK_MS as ae,schreibeAuftrag as T,sichereKonto as ue,startwissenEingeschaltet as E}from"./konto-anlegen.js";import{istInstanzKennung as z,sofortTestHinweis as le}from"./zugang.js";import{CURSOR_FLAG as h,cursorEreignis as j,cursorHookAntwort as fe,cursorLeer as de,istCursorNutzlast as x}from"./cursor-hook.js";import{COPILOT_FLAG as I,copilotEreignis as pe,copilotHookAntwort as me,istFremdeLaufzeit as C}from"./copilot-hook.js";import{CODEX_FLAG as K,codexHookAntwort as he}from"./codex-hook.js";import{GEMINI_FLAG as b,geminiEreignis as ge,geminiHookAntwort as Se}from"./gemini-hook.js";const we="https://api.cachly.dev",N=5e3,_e="ambient-auffrischen",R=new Set(["SessionStart","UserPromptSubmit","PreToolUse","Stop"]);async function ke(e,t){if(!e.args.includes(h)&&(j(t,e.args)!=="sessionStart"||se(e.umfeld)))return"";const o=e.args.filter(r=>r==="--plugin");return fe({payload:t,args:e.args,claudeLauf:(r,s)=>A({...e,raw:r,args:[s,...o]}),ablageOrdner:e.cursorAblage})}function Ie(e,t){const n=(o,r)=>A({...e,raw:o,args:[r]});return e.args.includes(I)?me({payload:t,args:e.args,claudeLauf:n,ablageOrdner:e.copilotAblage}):e.args.includes(K)?he({payload:t,args:e.args,claudeLauf:n}):e.args.includes(b)?Se({payload:t,args:e.args,claudeLauf:n}):null}function be(e,t){return e.includes(h)||x(t)?"cursor":e.includes(I)?"copilot":e.includes(K)?"codex":e.includes(b)?"gemini":C(t)?"vscode":"claude"}async function Ae(e){const t=await ue({apiUrl:e.apiUrl,version:F(e.umfeld),home:e.umfeld.heim,env:{...e.umfeld.env,CACHLY_QUELLE:"claude-code-plugin"},fristMs:N,anfrageMs:N,abkuehlungMs:ae,holen:e.fetchFn});if(t.art==="vorhanden")return{apiKey:t.apiKey,instanzId:t.instanzId,hinweis:""};if(t.art!=="angelegt")return null;if(E(e.umfeld.env)){const n={apiUrl:e.apiUrl,jwt:t.test.apiKey,instanceId:t.test.instanzId};e.selbst&&(e.nebenlauf??P)(n,[e.selbst,m,e.umfeld.projekt],{zweck:m,ordner:O()})||T({instanzId:t.test.instanzId,projekt:e.umfeld.projekt},{home:e.umfeld.heim})}return{apiKey:t.test.apiKey,instanzId:t.test.instanzId,hinweis:le(t.test)}}function He(e,t){const n=t.replace(/^\s+/,"");if(!e)return Z("SessionStart",n);try{const o=JSON.parse(e),r=o.hookSpecificOutput?.additionalContext;return!o.hookSpecificOutput||typeof r!="string"?e:(o.hookSpecificOutput.additionalContext=`${n}
|
|
2
2
|
|
|
3
|
-
${r}`,JSON.stringify(o))}catch{return
|
|
4
|
-
`);const i=
|
|
3
|
+
${r}`,JSON.stringify(o))}catch{return e}}async function A(e){try{const t=L(e.raw),n={...e,editor:e.editor??be(e.args,t)};if(n.args.includes(h)||x(t))return await ke(n,t);const o=Ie(n,t);if(o)return await o;const r=t?.hook_event_name??n.args.find(i=>R.has(i))??n.umfeld.env.CACHLY_HOOK_EVENT??"";if(C(t)&&(r!=="SessionStart"&&r!=="UserPromptSubmit"||ie(n.umfeld))||n.args.includes("--plugin")&&r&&ce(r,n.umfeld))return"";let s=null;if(r==="Stop"&&t?.transcript_path)try{s=B(t.transcript_path,"utf-8").split(`
|
|
4
|
+
`);const i=J(s,t.stop_hook_active===!0);if(i)return i}catch{}let l=_(n.umfeld),u=w(n.umfeld),c="";if(!l&&r==="SessionStart"&&n.args.includes("--plugin")&&!z(u)){const i=await Ae(n);i&&(l=i.apiKey,u=i.instanzId??u,c=i.hinweis)}if(!l||!u)return"";const a={apiUrl:n.apiUrl,jwt:l,instanceId:u};if(r==="Stop"){const i=t?.stop_hook_active===!0,d=p=>X(p,{apiUrl:a.apiUrl,jwt:a.jwt,instanceId:a.instanceId,version:F(n.umfeld),env:n.umfeld.env,fetchFn:n.fetchFn}),f=ne(a,t?.session_id??null,s,{fetchFn:n.fetchFn}),y=n.editor==="claude"&&s?V({zeilen:s,sessionId:t?.session_id??null,stopHookAktiv:i,heim:n.umfeld.heim,env:n.umfeld.env}):null;if(y)return await Promise.all([f,d("auto_learn_asked")]),y;const M=!!s&&(Q(s)||i&&W(n.umfeld.heim,t?.session_id??"")),U=t&&!M?D(t):null,G=U?(n.fetchFn??fetch)(`${a.apiUrl}/api/v1/instances/${a.instanceId}/learn`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a.jwt}`},body:JSON.stringify($(U)),signal:AbortSignal.timeout(8e3)}).then(p=>p&&p.ok?d("auto_learn_saved"):void 0).catch(()=>{}):void 0;return await Promise.all([G,f]),""}let g;const S=await(n.einblenden??Y)(n.raw,{cfg:a,nebenlauf:n.selbst?[n.selbst,_e]:void 0,editor:n.editor,fetchFn:n.fetchFn,onInject:(i,d)=>{const f={ts:new Date().toISOString(),event:d,injected:i,prevented:0,instanz:a.instanceId};re(f),g=oe(a,f,n.fetchFn)}});return g&&await Promise.race([g,new Promise(i=>setTimeout(i,500))]),r==="SessionStart"&&!S&&!c&&n.selbst&&E(n.umfeld.env)&&(n.nebenlauf??P)(a,[n.selbst,m,n.umfeld.projekt],{zweck:m,ordner:O()}),c?He(S,c):S}catch{return""}}async function ve(){if(process.stdin.isTTY)return"";const e=[];for await(const t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}function H(){return process.env.CACHLY_API_URL||we}const v={SessionStart:25e3,UserPromptSubmit:8e3,PreToolUse:8e3,Stop:5e4,sessionStart:25e3,beforeSubmitPrompt:8e3,postToolUse:3e3,userPromptSubmitted:8e3,PostToolUse:3e3,BeforeAgent:8e3};function ye(e,t){return e.includes(h)?de(j(t,e)):e.includes(I)?pe(t,e)?"{}":"":e.includes(b)&&ge(t,e)?"{}":""}async function Be(e,t){try{const n=await ve(),o=L(n),r=o?.hook_event_name??e.find(c=>R.has(c)||Object.hasOwn(v,c))??"",s=Number(process.env.CACHLY_HOOK_FRIST_MS)||v[r]||v.UserPromptSubmit,l=ye(e,o),u=await Promise.race([A({args:e,raw:n,umfeld:k(),apiUrl:H(),selbst:t}),new Promise(c=>setTimeout(()=>c(l),s))]);u&&await new Promise(c=>process.stdout.write(u,()=>c()))}catch{}process.exit(0)}async function Ye(){try{const e=k(),t=_(e),n=w(e);t&&n&&await q({apiUrl:H(),jwt:t,instanceId:n},{force:!0,lernen:!0})}catch{}process.exit(0)}async function $e(e){try{const t=k(),n=_(t),o=w(t);if(n&&z(o)){const r=await te({cfg:{apiUrl:H(),jwt:n,instanceId:o},projekt:e,env:t.env});r.art!=="aus"&&T({instanzId:o,projekt:e,vomHook:ee(r)},{home:t.heim})}}catch{}process.exit(0)}export{_e as AUFFRISCHEN,v as HOOK_FRIST_MS,N as KONTO_FRIST_MS,we as STANDARD_API_URL,Ye as auffrischenHauptlauf,be as editorVon,A as hookAntwort,Be as hookHauptlauf,$e as startwissenImportHauptlauf};
|
package/dist/src/herkunft.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as o}from"node:crypto";import{istMehrmandant as
|
|
1
|
+
import{createHash as o}from"node:crypto";import{istMehrmandant as u,mandantKontext as a}from"./remote-zugang.js";let s="";function g(e,n){if(u())return;const t=String(e??"").trim(),r=String(n??"").trim();s=t?r?`${t}/${r}`:t:""}function m(){return s}function p(e){const n=e.split(".");if(n.length!==3)return"";try{const t=Buffer.from(n[1].replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),r=JSON.parse(t).sub;return typeof r=="string"?r.slice(0,64):""}catch{return""}}function h(e=process.env){if(u()){const i=a(),c=i?i.sub?`sub:${i.sub.slice(0,64)}`:`key:${i.schluesselHash.slice(0,12)}`:void 0;return{agent:"mcp-http",...c?{principal:c}:{},via:"mcp"}}const n=String(e.CACHLY_AGENT??"").trim()||s||"unbekannt",t=String(e.CACHLY_JWT??"").trim();let r;if(t){const i=p(t);r=i?`sub:${i}`:`key:${o("sha256").update(t).digest("hex").slice(0,12)}`}return{agent:n,...r?{principal:r}:{},via:"mcp"}}function b(e,n){const t=[];return e&&t.push(`@${e}`),n?.agent&&n.agent!=="unbekannt"&&t.push(`via ${n.agent}`),n?.principal&&t.push(n.principal),t.length>0?`\u{1F464} **Source:** ${t.join(" \xB7 ")}`:"\u{1F464} **Source:** Urheber unbekannt"}export{m as clientKennungFuerTests,h as ermittleQuelle,b as quelleZeile,g as setzeClientKennung};
|